<div id="maincontent">
    <div id="maincontent_inner">
        <div id="sidebar">
            <div class="menu single">
                <ul>
                    <li><a href="#">保养项目管理</a>
                        <ul>
                            <li><a href="<?php echo site_url("c=care&m=index"); ?>">保养项目列表</a></li>
                            <li class="current"><a href="<?php echo site_url("c=care&m=add"); ?>">添加保养项目</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
        <div id="content">
            <div class="title">添加保养项目</div>
            <div class="infoarea">
                <form id="myform" action="<?php echo site_url("c=care&m=add"); ?>" method="post">
                    <table border="0" cellspacing="0" cellpadding="0" width="100%" class="aev">
                        <tr>
                            <th>保养项目名称:</th>
                            <td><input type="text" class="half" name="repairname"/><?php echo form_error('repairname'); ?></td>
                        </tr>
                        <tr>
                            <th>保养时间周期:</th>
                            <td><input type="text" class="small" name="repairtime"/><?php echo form_error('repairtime'); ?> <select name="repairtimetype"><option selected value="year">年</option><option value="month">月</option><option value="day">日</option></select></td>
                        </tr>
                        <tr>
                            <th>保养行驶公里数周期:</th>
                            <td><input type="text" class="small" name="repairmileage"/> 公里<?php echo form_error('repairmileage'); ?> </td>
                        </tr>
                        <tr>
                            <th>关联故障信息</th>
                            <td>
                                <?php foreach ($faultInfo as $fault): ?>
                                <input type="checkbox" name="faultid[]" value="<?php echo $fault['faultid']; ?>"/><?php echo $fault['faultname']; ?>
                                <?php endforeach ?>
                            </td>
                        </tr>
                    </table>
                    <div class="box nav" style="margin-top:5px;margin-bottom:0;">
                        &nbsp;<div style="float:right"><input type="submit" class="btn" value="确定"/><input type="submit" class="btn" value="返回"/></div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        $("#myform").validate({
            rules:{
                repairname:{
                    required:true
                },
                repairtime:{
                    required:true,
                    number:true
                },
                repairmileage:{
                    required:true,
                    number:true
                }
            },
            messages:{
                repairname:{
                    required:"保养项目名称不能为空"
                },
                repairtime:{
                    required:"保养时间周期不能为空",
                    number:"必须输入合法的数字"
                },
                repairmileage:{
                    required:"保养行驶公里数周期不能为空",
                    number:"必须输入合法的数字"
                }
            }
        });


    });

</script>

